#include "MatrixLED.h"
#include "Timer0.h"
#include <REGX52.H>

unsigned char code Animation[]={
0x00, 0x20, 0x7F, 0xF8, 0xB4, 0x02, 0x01, 0x01,
0x00, 0x00, 0x19, 0x3F, 0x7C, 0x57, 0x01, 0x00,
0x00, 0x00, 0x19, 0x3F, 0x7C, 0x57, 0x01, 0x00,
0x00, 0x00, 0x01, 0x02, 0x1C, 0x3C, 0x7B, 0x58,
0x00, 0x00, 0x19, 0x3F, 0x7C, 0x57, 0x01, 0x00,
0x00, 0x20, 0x7F, 0xF8, 0xB4, 0x02, 0x01, 0x01,
0x20, 0x10, 0x20, 0xFF, 0xF8, 0x26, 0x12, 0x08,
0x00, 0xC0, 0x20, 0xFF, 0xFA, 0x24, 0xC0, 0x00,
0x00, 0x00, 0x30, 0x7F, 0xFE, 0xA1, 0x00, 0x00,
0x00, 0x00, 0x20, 0x7F, 0xFA, 0xAC, 0x20, 0x40,
0x00, 0x00, 0x30, 0x7F, 0xF8, 0xB6, 0x00, 0x00,
0x00, 0x00, 0x30, 0x7F, 0xF8, 0xB6, 0x00, 0x00,
0x00, 0x03, 0x24, 0x78, 0xF8, 0xB6, 0x01, 0x00,
0x00, 0x20, 0x7F, 0xF8, 0xB4, 0x02, 0x01, 0x00,
0x00, 0x01, 0x1B, 0x3C, 0x7C, 0x56, 0x01, 0x00,
0x00, 0x00, 0x01, 0x02, 0x1C, 0x3C, 0x7B, 0x58,
0x00, 0x00, 0x19, 0x3E, 0x7C, 0x56, 0x01, 0x00,
0x00, 0x10, 0x3F, 0x7C, 0x5A, 0x01, 0x00, 0x00,
0x00, 0x00, 0x01, 0x02, 0x1C, 0x3C, 0x7B, 0x58,
0x00, 0x00, 0x19, 0x3E, 0x7C, 0x56, 0x01, 0x00,
0x00, 0x20, 0x7F, 0xF8, 0xB4, 0x02, 0x01, 0x00,
0x00, 0x00, 0x19, 0x3E, 0x7C, 0x56, 0x01, 0x00,
0x00, 0x00, 0x01, 0x02, 0x1C, 0x3C, 0x7B, 0x58,
0x00, 0x00, 0x19, 0x3E, 0x7C, 0x56, 0x01, 0x00,
0x00, 0x20, 0x7F, 0xF8, 0xB4, 0x02, 0x01, 0x00,
0x00, 0x00, 0x19, 0x3E, 0x7C, 0x56, 0x01, 0x00,
0x00, 0x00, 0x01, 0x02, 0x1C, 0x3C, 0x7B, 0x58,
0x00, 0x00, 0x19, 0x3E, 0x7C, 0x56, 0x01, 0x00,
0x00, 0x20, 0x7F, 0xF8, 0xB4, 0x02, 0x01, 0x00,
0x00, 0x00, 0x19, 0x3E, 0x7C, 0x56, 0x01, 0x00,
0x00, 0x00, 0x01, 0x02, 0x1C, 0x3C, 0x7B, 0x58,
};

unsigned char i,offset=0;//count=0;
void main()
{
	void MatrixLED_Init();
	Timer0_Init();
	while(1)
	{
		for(i=0;i<8;i++)
		{
			MatrixLED_ShowColumn(i,Animation[i+offset]);
		}
//		count++;
//		if(count>10);
//		{
//			count=0;
//			offset++;
//			if(offset>32)
//			{
//				offset=0;
//			}
//		}
	}
}
void Timer0_Routine() interrupt 1
{
	static unsigned int T0Count;
	TH0=0xFC;	
	TL0=0x66;
	T0Count++;
	if(T0Count>=600)
	{
		T0Count=0;
		offset+=8;
			if(offset>240)
			{  
				offset=0;
			}
	}
}
